<template>
  <div>
    <div>
      <h4>下肢评定</h4>
      <el-row type="flex" justify="space-between">
        <el-col :span="12">
          <div>
            <span>L2左（屈髋肌左） </span>
            <el-input v-model.number="pgForm.input.lower_limb_assessment_input1" placeholder="" @blur="isNaNa(pgForm.input.lower_limb_assessment_input1)"></el-input>
            <span> 分</span>
          </div>
        </el-col>
        <el-col :span="12">
          <div>
            <span>L2右（屈髋肌右） </span>
            <el-input v-model.number="pgForm.input.lower_limb_assessment_input2" placeholder="" @blur="isNaNa(pgForm.input.lower_limb_assessment_input2)"></el-input>
            <span> 分</span>
          </div>
        </el-col>
        <el-col :span="12">
          <div>
            <span>L3左（伸膝肌左） </span>
            <el-input v-model.number="pgForm.input.lower_limb_assessment_input3" placeholder="" @blur="isNaNa(pgForm.input.lower_limb_assessment_input3)"></el-input>
            <span> 分</span>
          </div>
        </el-col>
        <el-col :span="12">
          <div>
            <span>L3右（伸膝肌右） </span>
            <el-input v-model.number="pgForm.input.lower_limb_assessment_input4" placeholder="" @blur="isNaNa(pgForm.input.lower_limb_assessment_input4)"></el-input>
            <span> 分</span>
          </div>
        </el-col>
        <el-col :span="12">
          <div>
            <span>L4左（踝背伸肌左） </span>
            <el-input v-model.number="pgForm.input.lower_limb_assessment_input5" placeholder="" @blur="isNaNa(pgForm.input.lower_limb_assessment_input5)"></el-input>
            <span> 分</span>
          </div>
        </el-col>
        <el-col :span="12">
          <div>
            <span>L4右（课背伸肌右） </span>
            <el-input v-model.number="pgForm.input.lower_limb_assessment_input6" placeholder="" @blur="isNaNa(pgForm.input.lower_limb_assessment_input6)"></el-input>
            <span> 分</span>
          </div>
        </el-col>
        <el-col :span="12">
          <div>
            <span>L5左（拇长伸肌左） </span>
            <el-input v-model.number="pgForm.input.lower_limb_assessment_input7" placeholder="" @blur="isNaNa(pgForm.input.lower_limb_assessment_input7)"></el-input>
            <span> 分</span>
          </div>
        </el-col>
        <el-col :span="12">
          <div>
            <span>L5右（拇长伸肌右） </span>
            <el-input v-model.number="pgForm.input.lower_limb_assessment_input8" placeholder="" @blur="isNaNa(pgForm.input.lower_limb_assessment_input8)"></el-input>
            <span> 分</span>
          </div>
        </el-col>
        <el-col :span="12">
          <div>
            <span>S1左（踝跖屈肌左） </span>
            <el-input v-model.number="pgForm.input.lower_limb_assessment_input9" placeholder="" style="width: 30%;" @blur="isNaNa(pgForm.input.lower_limb_assessment_input9)"></el-input>
            <span> 分</span>
          </div>
        </el-col>
        <el-col :span="12">
          <div>
            <span>S1右（踝跖屈肌右）  </span>
            <el-input v-model.number="pgForm.input.lower_limb_assessment_input10" placeholder="" style="width: 30%;" @blur="isNaNa(pgForm.input.lower_limb_assessment_input10)"></el-input>
            <span> 分</span>
          </div>
        </el-col>
        <el-col>
          <span>(VAC) 肛门自主收缩</span>
          <div class="grid-content">
            <el-radio-group v-model="pgForm.lower_limb_assessment_radio">
              <el-radio :label="3">是</el-radio>
              <el-radio :label="6">否</el-radio>
              <el-input v-model.number="pgForm.input.lower_limb_assessment_input11" placeholder="备注"></el-input>
            </el-radio-group>
          </div>
        </el-col>
        <el-col :span="12">
          <div>
            <span>下肢总分（最大50分） </span>
            <el-input v-model="pgForm.input.lower_limb_assessment_input12" placeholder="" readonly></el-input>
            <span> 分</span>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
export default {
  name: "lower_limb_assessment",
  title: "下肢评定",
  created() {
    if(this.istrans){
      this.pgForm=this.fromdata
    }
  },
  props: {
    fromdata:{},
    istrans:false,
  },
  data() {
    return {
      pgForm: {
        input:{
          lower_limb_assessment_input1: '',
          lower_limb_assessment_input2: '',
          lower_limb_assessment_input3: '',
          lower_limb_assessment_input4: '',
          lower_limb_assessment_input5: '',
          lower_limb_assessment_input6: '',
          lower_limb_assessment_input7: '',
          lower_limb_assessment_input8: '',
          lower_limb_assessment_input9: '',
          lower_limb_assessment_input10: '',
          lower_limb_assessment_input11: '',
          lower_limb_assessment_input12: '',
        },
        lower_limb_assessment_radio: 0
      },

    }
  },
  methods: {
    isNaNa(val){
      if(isNaN(val)){
        this.open()
        for(var i in this.pgForm.input){
          if(this.pgForm.input[i] === val){
            this.pgForm.input[i] = ''
          }
        }
      }
    },
    open() {
      this.$message({
        message: '请输入数字！',
        type: 'warning'
      });
    },
  },
  computed: {
    sum(){
      return (this.pgForm.input.lower_limb_assessment_input1)*1+(this.pgForm.input.lower_limb_assessment_input2)*1+(this.pgForm.input.lower_limb_assessment_input3)*1+(this.pgForm.input.lower_limb_assessment_input4)*1+(this.pgForm.input.lower_limb_assessment_input5)*1+(this.pgForm.input.lower_limb_assessment_input6)*1+(this.pgForm.input.lower_limb_assessment_input7)*1+(this.pgForm.input.lower_limb_assessment_input8)*1+(this.pgForm.input.lower_limb_assessment_input9)*1+(this.pgForm.input.lower_limb_assessment_input10)*1
    }
  },
  watch: {
    sum(val){
      if(!isNaN(val)){
        this.pgForm.input.lower_limb_assessment_input12 = val
      }
    }
  }
}
</script>

<style scoped>
.el-row{
  margin: 10px 0;
  padding: 20px 20px;
  background-color: #f9f9f9;
  flex-wrap: wrap;
  flex-direction: row;
}
.el-col {
  margin:10px 0;
}
.el-input{
  width: 50%;
}
.el-radio-group{
  padding: 10px 20px;
}
.el-radio{
  display: block;
  margin-bottom: 15px;
}
.sixRow span{
  display: block;
}
</style>
